package com.haoxin.ai_course.modules.course.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.haoxin.ai_course.common.base.EasyBaseMapper;
import com.haoxin.ai_course.modules.course.entity.AcNodeUser;

/**
 * 环节用户表
 * 
 * @author xingxiangguo
 * @email bugcn@qq.com
 * @date 2022-06-10 17:24:28
 */
public interface AcNodeUserMapper  extends EasyBaseMapper<AcNodeUser> {
	@Select(" select  max(node_id) nodeId from ac_node_user where user_id=#{userId} and course_id=#{courseId} ")
	AcNodeUser getCurrentNode(@Param("userId") Long userId, @Param("courseId")Integer courseId);
	@Update("update ac_node_user set is_enter=#{acNodeUser.isEnter},version=#{acNodeUser.version}+1 where id=#{acNodeUser.id} and version=#{acNodeUser.version}")
	int changeIsEnter(@Param("acNodeUser")AcNodeUser acNodeUser);
	
}
